package chapter15.exercise.ch15;

public class Holder<T> {
    private T value;

    public Holder() {
    }

    public Holder(T val) {
        value = val;
    }

    public T get() {
        return value;
    }

    public void set(T t) {
        value = t;
    }

    public boolean equals(Object obj) {
        return value.equals(obj);
    }

    public static void main(String[] args) {
        Holder<Apple> Apple = new Holder<>(new Apple());
        Apple d = Apple.get();
        //Holder<Fruit> Fruit = Apple;//Type mismatch: cannot convert from Holder<Apple> to Holder<Fruit>
    }
}
